'use strict';
var arr = [];

for (let i = 0; i < 100; i++) {
    arr.push(i);
}

function get_primes(arr) {
    return arr.filter(x => {
        if (x <= 1) return 0;

        var len = x / 2 > 7 ? 7 : x / 2;
        for (let i = 2; i < len; i++)
            if (!(x % i)) return 0;

        return 1;
    });
}

// 测试:
var r = get_primes(arr);
if (r.toString() === [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97].toString()) {
    console.log('测试通过!');
} else {
    console.log('测试失败: ' + r.toString());
}